package com.ftg.learn.chapter11.javabase;


import com.mysql.cj.jdbc.MysqlDataSource;
import org.apache.ibatis.logging.slf4j.Slf4jImpl;
import org.apache.ibatis.mapping.Environment;
import org.apache.ibatis.session.Configuration;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.apache.ibatis.transaction.TransactionFactory;
import org.apache.ibatis.transaction.jdbc.JdbcTransactionFactory;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import org.springframework.beans.factory.ObjectProvider;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.core.ResolvableType;

/**
 * @author 布衣
 */
public class Play {

    public static void main(String[] args) {
        AnnotationConfigApplicationContext b = new AnnotationConfigApplicationContext(JavaConfiguration.class);
        SqlSessionFactory bean = b.getBean(SqlSessionFactory.class);

        SqlSession sqlSession = bean.openSession();
        Dept dept = sqlSession.getMapper(Dept.class);
        System.out.println(dept.list());
        sqlSession.close();
        sqlSession.commit();
        sqlSession.rollback();

        //1 讲完的全部试一次
        //2 简答  spring类加载流程
        //3 尝试把mybatis的javabase里面的sqlsessionfactory注入到spring当中 【spring+mybatis】

    }

}
